namespace WhoCanHelpMe.Web.Controllers.Profile.Mappers
{
    #region Using Directives

    using AutoMapper;

    using Contracts;

    using Domain;

    using Shared.Mappers.Contracts;

    using ViewModels;

    #endregion

    public class CreateProfilePageViewModelMapper : ICreateProfilePageViewModelMapper
    {
        private readonly IPageViewModelBuilder pageViewModelBuilder;

        public CreateProfilePageViewModelMapper(IPageViewModelBuilder pageViewModelBuilder)
        {
            this.pageViewModelBuilder = pageViewModelBuilder;
            Mapper.CreateMap<CreateProfileDetails, CreateProfilePageViewModel>();
        }

        public CreateProfilePageViewModel MapFrom(CreateProfileDetails input)
        {
            var viewModel = Mapper.Map<CreateProfileDetails, CreateProfilePageViewModel>(input);

            return this.pageViewModelBuilder.UpdateSiteProperties(viewModel);
        }
    }
}